cd "$replication\code\"

set matsize 5000

****************************************************************************** Input variables ************************************************************
global cluster "sd_code"
global AS_infs `""""'
global AS_var "NA"
global sample "year!=."
global controls ""
global controlsXYFEs ""
global controlsXinfs ""
global omitted_year1=-1
global omitted_year2=-6
global min_year=-6
global max_year=5
global colour="no_graphs"
global depvar "icw_irrigation"

global int "elecXroad"
local inf1=substr("${int}",1,4)
local inf2=substr("${int}",6,.)
global  infs "`inf1' `inf2' ${int}"
global absorb "shrid_code i.s_code#i.year"
global depvar "icw_irrigation"


global controls "ln_rain*"
qui : do Z_Event_code.do
estimates replay main_regression
qui estimates restore main_regression
foreach inf in $infs {
	lincom ${post_terms_`inf'}
}


global title "Places with and without roads"
global int "elec"
global controls ""
global sample "year!=. & subdistrict_road==1 & year<year_road"
global absorb "shrid_code i.s_code#i.year i.s_code#i.year#pc01_vd_tar_road"
global AS_infs `""elec""'
global AS_var "s_code"
global  infs "elec elecXR"
qui : do Z_Event_code.do
qui estimates restore main_regression
foreach inf in $infs {
	lincom ${post_terms_`inf'}
}

global title "Places with and without electricity"
global int "road"
global sample "year!=. & subdistrict_elec==1 & year<year_elec"
global absorb "shrid_code  i.s_code#i.year#E"
global  infs "road roadXE"
global AS_infs `""road""'
global AS_var "s_code"
qui : do Z_Event_code.do
qui estimates restore main_regression
foreach inf in $infs {
	lincom ${post_terms_`inf'}
}

global int "elecXroad"
global absorb "shrid_code i.s_code#i.year"
global sample "year!=. "
global  infs "elec road ${int} in2km_elec in2km_road in2km_elecXroad"
global AS_infs `""N/A""'
global AS_var ""

qui : do Z_Event_code.do
qui estimates restore main_regression
foreach inf in $infs {
	lincom ${post_terms_`inf'}
}
